package com.haozi;

import com.haozi.config.*;
import com.haozi.core.DataMonitor;

import lombok.extern.slf4j.Slf4j;
import org.springframework.context.annotation.AnnotationConfigApplicationContext;

/**
 * @author zyh
 * @version 1.0
 * @date 2022/4/27 10:45 上午
 */
@Slf4j
public class Bootstrap {


    public static void main(String[] args) {

        //spring 上下文 初始化
        AnnotationConfigApplicationContext
                context = new AnnotationConfigApplicationContext("com.haozi");

        //注册全局配置
        GlobalArgs globalArgs = context.getBean(GlobalArgs.class);
        GlobalConfig globalConfig = context.getBean(GlobalConfig.class);
        globalArgs.init(args);
        globalConfig.init();
        //数据监控模块
        DataMonitor getdataHandler = context.getBean(DataMonitor.class);
        DataSourceConfigFactory dataSourceConfigFactory = context.getBean(DataSourceConfigFactory.class);
        //数据源配置
        DataSourcelConfig dataSourcelConfig = dataSourceConfigFactory.dataSourcelConfig();

        getdataHandler.start(dataSourcelConfig);
    }


}
